﻿using DosTexPrj.Implement.NHibernate.Mapping;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate.Cfg;

namespace DosTexPrj.Implement.NHibernate
{
    public class NHibernateUtility
    {
        public static Configuration BuildConfigurationMsSql()
        {
            return Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008.ConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["DotTexConnection"].ConnectionString))
                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<RoleMapping>())
                .BuildConfiguration();
        }

        public static Configuration BuildConfigurationForSQLite()
        {
            return Fluently.Configure()
                .Database(SQLiteConfiguration.Standard.InMemory())
                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<RoleMapping>())
                .BuildConfiguration();
        }
    }
}